<template>
  <view>
    <button @click="onLog()">console.log</button>
    <button @click="onDebug()">console.debug</button>
    <button @click="onInfo()">console.info</button>
    <button @click="onWarn()">console.warn</button>
    <button @click="onError()">console.error</button>
  </view>
</template>

<script>
export default {
  data() {
    return {
      title: '打印日志',
      name: 'wangziyu',
      pwd: '2222'
    }
  },
  methods: {
   
    onLog() {
      console.log('-------this.title: ', this.title);
    },

    onDebug() {
      console.debug('-------this.name: ', this.name);
    },

    onInfo() {
      console.info('-------this.pwd: ', this.pwd);
    },
   
    onWarn() {
      if (this.name === 'wzy') { 
        console.log("登录验证成功");
      } else {
        console.warn("this is warn log：用户名不匹配");
      }
    },
   
    onError() {
      console.error("this is a error message");
      try {
   
        console.log(undefinedVar);
      } catch (e) {
        console.error("catch 捕获错误：" + e);
      }
    }
  }
}
</script>

<style>
button {
  margin: 20rpx;
  padding: 15rpx 30rpx;
}
</style>